package com.lin.missyou.repository;

import com.lin.missyou.model.Activity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * @author gcq
 * @Create 2021-11-03
 */
@Repository
public interface ActivityRepository extends JpaRepository<Activity, Long> {

    Activity findByName(String name);

    /**
     * 两表join查询
     * 观察运行时 sql 语句
     * @param couponId
     * @return
     */
    Optional<Activity> findByCouponListId(Long couponId);
}